require(['./config'],() => {
    require(['request','template','header','footer'],(request,template) => {
        class Detail {
            constructor () {
                this.getDetailData()
            }
            getDetailData () {
                const id = window.location.search.slice(4)
                // console.log(id)
                request.getDetail(id).then(resp => {
                    console.log(resp)
                    const {
                        id,
                        image,
                        photo,
                        title,
                        couponStatus,
                        couponValue,
                        originPrice,
                        price,
                        descContentList
                    } = resp.data.detail
                    const list = {
                        id,
                        image,
                        photo,
                        title,
                        couponStatus,
                        couponValue,
                        originPrice,
                        price,
                        descContentList
                    }
                    console.log(list)   
                    $('#detail').html(template('detailTemplate',{...list}))
                })
            }
        }
        new Detail()
        
    })
})